#define  _CRT_SECURE_NO_WARNINGS 1
/**
 * Definition for a binary tree node.
 * struct TreeNode {
 *     int val;
 *     struct TreeNode *left;
 *     struct TreeNode *right;
 * };
 */
typedef struct TreeNode TreeNode;
bool isSameTree(TreeNode* q, TreeNode* p)
{
    if (q == NULL && p == NULL)
    {
        return true;
    }
    if (q == NULL || p == NULL)
    {

        return false;
    }
    if (q->val != p->val)
    {
        return false;
    }
    return isSameTree(q->left, p->right) && isSameTree(q->right, p->left);
}
bool isSymmetric(struct TreeNode* root)
{
    return isSameTree(root->left, root->right);
}